<template>
    <div class="wrap">
        <!-- 树状图下拉 -->
        <a-form-item :label="item.label" :required="item.required">
            <a-tree-select :disabled="item.disabled"
                v-decorator="[item.dataIndex, { rules: [{ required: item.required, message: getMessage(item) }] }]"
                show-search :allowClear="true" style="width: 100%" :replaceFields="replaceFields"
                :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :placeholder="getMessage(item)"
                :tree-data="item.selectTreeData">
            </a-tree-select>
        </a-form-item>
    </div>
</template>
<script>
import { getMessage } from './js/js';

export default {
    name: 'FormSelectTree',
    props: {
        item: {
            type: Object,
            default: () => { }
        },
        formVal: {
            type: Object,
            default: () => { }
        },
        formData: {
            type: [Array, Object],
            default: () => []
        },
        form: {
            type: [Array, Object, String],
        }
    },
    data() {
        return {
            replaceFields: {
                children: "child",
                title: "name",
                value: 'id',
                key: "key",
            },
        }
    },
    methods: {
        getMessage,
    }
}
</script>
<style lang="less" scoped>
.wrap {}
</style>